{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "20194731",
   "metadata": {},
   "source": [
    "# 啤酒歌"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "fb63b940",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 瓶 bottles 在啤酒柜上\n",
      "99 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "98 瓶 bottles 在啤酒柜上\n",
      "98 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "97 瓶 bottles 在啤酒柜上\n",
      "97 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "96 瓶 bottles 在啤酒柜上\n",
      "96 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "95 瓶 bottles 在啤酒柜上\n",
      "95 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "94 瓶 bottles 在啤酒柜上\n",
      "94 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "93 瓶 bottles 在啤酒柜上\n",
      "93 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "92 瓶 bottles 在啤酒柜上\n",
      "92 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "91 瓶 bottles 在啤酒柜上\n",
      "91 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "90 瓶 bottles 在啤酒柜上\n",
      "90 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "89 瓶 bottles 在啤酒柜上\n",
      "89 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "88 瓶 bottles 在啤酒柜上\n",
      "88 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "87 瓶 bottles 在啤酒柜上\n",
      "87 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "86 瓶 bottles 在啤酒柜上\n",
      "86 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "85 瓶 bottles 在啤酒柜上\n",
      "85 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "84 瓶 bottles 在啤酒柜上\n",
      "84 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "83 瓶 bottles 在啤酒柜上\n",
      "83 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "82 瓶 bottles 在啤酒柜上\n",
      "82 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "81 瓶 bottles 在啤酒柜上\n",
      "81 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "80 瓶 bottles 在啤酒柜上\n",
      "80 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "79 瓶 bottles 在啤酒柜上\n",
      "79 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "78 瓶 bottles 在啤酒柜上\n",
      "78 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "77 瓶 bottles 在啤酒柜上\n",
      "77 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "76 瓶 bottles 在啤酒柜上\n",
      "76 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "75 瓶 bottles 在啤酒柜上\n",
      "75 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "74 瓶 bottles 在啤酒柜上\n",
      "74 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "73 瓶 bottles 在啤酒柜上\n",
      "73 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "72 瓶 bottles 在啤酒柜上\n",
      "72 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "71 瓶 bottles 在啤酒柜上\n",
      "71 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "70 瓶 bottles 在啤酒柜上\n",
      "70 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "69 瓶 bottles 在啤酒柜上\n",
      "69 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "68 瓶 bottles 在啤酒柜上\n",
      "68 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "67 瓶 bottles 在啤酒柜上\n",
      "67 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "66 瓶 bottles 在啤酒柜上\n",
      "66 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "65 瓶 bottles 在啤酒柜上\n",
      "65 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "64 瓶 bottles 在啤酒柜上\n",
      "64 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "63 瓶 bottles 在啤酒柜上\n",
      "63 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "62 瓶 bottles 在啤酒柜上\n",
      "62 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "61 瓶 bottles 在啤酒柜上\n",
      "61 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "60 瓶 bottles 在啤酒柜上\n",
      "60 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "59 瓶 bottles 在啤酒柜上\n",
      "59 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "58 瓶 bottles 在啤酒柜上\n",
      "58 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "57 瓶 bottles 在啤酒柜上\n",
      "57 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "56 瓶 bottles 在啤酒柜上\n",
      "56 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "55 瓶 bottles 在啤酒柜上\n",
      "55 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "54 瓶 bottles 在啤酒柜上\n",
      "54 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "53 瓶 bottles 在啤酒柜上\n",
      "53 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "52 瓶 bottles 在啤酒柜上\n",
      "52 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "51 瓶 bottles 在啤酒柜上\n",
      "51 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "50 瓶 bottles 在啤酒柜上\n",
      "50 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "49 瓶 bottles 在啤酒柜上\n",
      "49 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "48 瓶 bottles 在啤酒柜上\n",
      "48 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "47 瓶 bottles 在啤酒柜上\n",
      "47 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "46 瓶 bottles 在啤酒柜上\n",
      "46 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "45 瓶 bottles 在啤酒柜上\n",
      "45 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "44 瓶 bottles 在啤酒柜上\n",
      "44 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "43 瓶 bottles 在啤酒柜上\n",
      "43 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "42 瓶 bottles 在啤酒柜上\n",
      "42 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "41 瓶 bottles 在啤酒柜上\n",
      "41 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "40 瓶 bottles 在啤酒柜上\n",
      "40 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "39 瓶 bottles 在啤酒柜上\n",
      "39 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "38 瓶 bottles 在啤酒柜上\n",
      "38 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "37 瓶 bottles 在啤酒柜上\n",
      "37 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "36 瓶 bottles 在啤酒柜上\n",
      "36 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "35 瓶 bottles 在啤酒柜上\n",
      "35 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "34 瓶 bottles 在啤酒柜上\n",
      "34 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "33 瓶 bottles 在啤酒柜上\n",
      "33 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "32 瓶 bottles 在啤酒柜上\n",
      "32 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "31 瓶 bottles 在啤酒柜上\n",
      "31 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "30 瓶 bottles 在啤酒柜上\n",
      "30 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "29 瓶 bottles 在啤酒柜上\n",
      "29 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "28 瓶 bottles 在啤酒柜上\n",
      "28 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "27 瓶 bottles 在啤酒柜上\n",
      "27 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "26 瓶 bottles 在啤酒柜上\n",
      "26 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "25 瓶 bottles 在啤酒柜上\n",
      "25 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "24 瓶 bottles 在啤酒柜上\n",
      "24 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "23 瓶 bottles 在啤酒柜上\n",
      "23 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "22 瓶 bottles 在啤酒柜上\n",
      "22 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "21 瓶 bottles 在啤酒柜上\n",
      "21 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "20 瓶 bottles 在啤酒柜上\n",
      "20 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "19 瓶 bottles 在啤酒柜上\n",
      "19 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "18 瓶 bottles 在啤酒柜上\n",
      "18 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "17 瓶 bottles 在啤酒柜上\n",
      "17 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "16 瓶 bottles 在啤酒柜上\n",
      "16 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "15 瓶 bottles 在啤酒柜上\n",
      "15 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "14 瓶 bottles 在啤酒柜上\n",
      "14 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "13 瓶 bottles 在啤酒柜上\n",
      "13 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "12 瓶 bottles 在啤酒柜上\n",
      "12 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "11 瓶 bottles 在啤酒柜上\n",
      "11 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "10 瓶 bottles 在啤酒柜上\n",
      "10 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "9 瓶 bottles 在啤酒柜上\n",
      "9 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "8 瓶 bottles 在啤酒柜上\n",
      "8 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "7 瓶 bottles 在啤酒柜上\n",
      "7 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "6 瓶 bottles 在啤酒柜上\n",
      "6 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "5 瓶 bottles 在啤酒柜上\n",
      "5 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "4 瓶 bottles 在啤酒柜上\n",
      "4 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "3 瓶 bottles 在啤酒柜上\n",
      "3 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "\n",
      "2 瓶 bottles 在啤酒柜上\n",
      "2 bottles :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "1 bottle of beer on the wall\n",
      "\n",
      "1 瓶 bottle 在啤酒柜上\n",
      "1 bottle :瓶\n",
      "Take one down\n",
      "Pass it around\n",
      "没有更多的雪花啤酒了\n",
      "\n"
     ]
    }
   ],
   "source": [
    "word = \"bottles\"\n",
    "for beer_num in range(99,0,-1):\n",
    "    # 吧台靓仔讲\n",
    "    print(beer_num,\"瓶\",word,\"在啤酒柜上\")\n",
    "    print(beer_num,word,\":瓶\")\n",
    "    print(\"Take one down\")\n",
    "    print(\"Pass it around\")\n",
    "    # 客户\n",
    "    if beer_num == 1:\n",
    "        print(\"没有更多的雪花啤酒了\")\n",
    "    else:\n",
    "        # 因为数值是可以运算的\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "            print(new_num,word,\"of beer on the wall\")\n",
    "    # 空行\n",
    "    print()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f22cb9e7",
   "metadata": {},
   "source": [
    "# 关于注释"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7c58838e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "import random\n",
      "wait_time = random.randint(1,60)\n",
      "print(wait_time)\n",
      "\n",
      "word = \"bottles\"\n",
      "print(word)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 注释的意义：\n",
    "# 1. 可以记录我们的代码过程意义（一般循环、条件判断、函数、对象、类都要有自己的描述，对变量作描述）\n",
    "# 2. 可以忽略一部分代码，跳过该部分执行的代码\n",
    "\n",
    "# A. 单行注释： #\n",
    "# B. 多行注释： ''' 注释内容 ''' \"\"\" 注释内容 \"\"\"\n",
    "# C. 多行注释可以当做  str  赋值给变量\n",
    "\n",
    "\n",
    "\"\"\"\n",
    "str的定义:\n",
    "Single quotes: 'allows embedded \"double\" quotes'\n",
    "Double quotes: \"allows embedded 'single' quotes\".\n",
    "Triple quoted: '''Three single quotes''', \\\"\"\"Three double quotes\\\"\"\"\n",
    "\"\"\"\n",
    "#  c. 通常可以打印时使用   或  在 python中存储其他语言的代码\n",
    "\n",
    "# \"\"\" 被注释内容 \"\"\"  还可以打印变量\n",
    "test1 ='''\n",
    "import random\n",
    "wait_time = random.randint(1,60)\n",
    "print(wait_time)\n",
    "\n",
    "word = \"bottles\"\n",
    "print(word)\n",
    "'''\n",
    "print(test1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df66e2ca",
   "metadata": {},
   "source": [
    "# 用户输入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c2c2879c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入您的账号:wingyi\n",
      "请输入您的密码:123456\n",
      "您输入的账号或密码不正确，请重新输入，您还有 2 次尝试的机会\n",
      "请输入您的账号:zhichao\n",
      "请输入您的密码:87631\n",
      "您输入的账号或密码不正确，请重新输入，您还有 1 次尝试的机会\n"
     ]
    }
   ],
   "source": [
    "# Author: Wingyi\n",
    "# week04\n",
    "\n",
    "# 判断 数据库中的用户信息 =? 用户登录输入的信息\n",
    "# 产品需求\n",
    "# 1.如果成功输入，账号密码，显示登陆成功，欢迎 用户的名字 使用\n",
    "# 2.如果输入失败，让用户重新输入，并显示 账号或密码输入错误\n",
    "# 3.如果输入失败，让用户重新输入，并显示 账号或密码输入错误 还有三次尝试的机会\n",
    "\n",
    "# while True 使用案例\n",
    "# 1.可实现for循环+ range的功能\n",
    "# 2.可给定特定的条件（比如说 账号和密码都相等）跳出\n",
    "\n",
    "# while True + count 计数器  VS  for循环 + range()\\\n",
    "# while True + 结束条件\n",
    "'''\n",
    "count = 0\n",
    "while True:\n",
    "    # count = count+1\n",
    "    count +=5\n",
    "    print(\"你是风儿我是沙,缠缠绵绵到天涯...\",count)\n",
    "    if count == 100:\n",
    "        break\n",
    "'''\n",
    "\n",
    "# 数据库中的用户信息\n",
    "user_data = [\"wingyi\",\"youge\",\"gaojin\",\"zhichao\"]\n",
    "password_data = [\"123456\",\"435728\",\"87631\"]\n",
    "\n",
    "count = 3\n",
    "while True:\n",
    "    # count 自减1: count _= 1\n",
    "    count -= 1\n",
    "\n",
    "# 用户登录输入的信息\n",
    "    username = input(\"请输入您的账号:\")\n",
    "    password = input(\"请输入您的密码:\")\n",
    "\n",
    "    if user_data == username:\n",
    "    # 判断 密码是否正确\n",
    "    # a.密码正确\n",
    "        if password_data == password:\n",
    "          print(\"登陆成功，欢迎%s使用~~\"%(username))\n",
    "          break\n",
    "    # b.密码不正确\n",
    "        else:\n",
    "            if count == 0:\n",
    "                print(\"账号或密码输入错误！请重新输入，您还有\",count,\"次尝试的机会\")\n",
    "                break\n",
    "    #2.账号不正确\n",
    "            else:\n",
    "                print(\"账号或密码输入错误！请重新输入，您还有\",count,\"次尝试的机会\")\n",
    "    else:\n",
    "        if count == 0:\n",
    "            print(\"你都输入三次了，还不对，五分钟后再输吧！\")\n",
    "            break\n",
    "        else:\n",
    "            print(\"您输入的账号或密码不正确，请重新输入，您还有\",count,\"次尝试的机会\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6ca1c854",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
